import java.time.LocalDate;
import java.time.format.DateTimeFormatter;

/**
 * @version : V1.0
 * @program: maven
 * @ClassName: D2
 * @Description:
 * @Author: chenxiejia
 * @Date: 2022/2/10 14:44
 */
public class D2 {
    public static void main(String[] args) {
        LocalDate ld = LocalDate.of(2022, 2, 23);
        //是不是闰年
        System.out.println(ld.isLeapYear());//false
        System.out.println(ld.getYear());//2022
        System.out.println(ld.getMonth());//FEBRUARY
        System.out.println(ld.getDayOfMonth());//23
        System.out.println(ld.getMonthValue());//2
        System.out.println(ld.getDayOfWeek());//WEDNESDAY
        System.out.println(ld.getDayOfYear());//54
        //增加天数
        LocalDate tom = ld.plusDays(1);
        System.out.println(tom.getDayOfMonth());//24
        //减少天数
        LocalDate yes = ld.minusDays(1);
        System.out.println(yes.getDayOfMonth());//22
        //文本按格式转化成日期
        LocalDate ld1 = LocalDate.parse("2022-02-10", DateTimeFormatter.ofPattern("yyyy-MM-dd"));
        System.out.printf("%tF%n", ld1);//2022-02-10
        System.out.println(ld1.format(DateTimeFormatter.ofPattern("yyyy年MM月dd日")));//2022年02月10日
        
    }
}
